//
//  SelfSizeTool.m
//  SelfSizeTool
//
//  Created by LL.F on 16/7/27.
//  Copyright © 2016年 LL.F. All rights reserved.
//

#import "SelfSizeTool.h"

@implementation SelfSizeTool
+ (CGFloat)selfSizeHeightWithString:(NSString *)string width:(CGFloat)width font:(UIFont *)font
{
    
    CGRect newRect = [string boundingRectWithSize:CGSizeMake(width, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : font} context:nil];
    return newRect.size.height;
}
+ (CGFloat)selfSizeWidthWithString:(NSString *)string height:(CGFloat)height font:(UIFont *)font
{
    
    CGRect newRect = [string boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, height) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: font} context:nil];
    return  newRect.size.width;

}

@end
